package com.demo.pojo;


import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Past;
import java.util.Date;

public class Goods {
    @NotBlank(message = "{goods.name.required}")
    private String gname;
    @NotBlank(message = "{goods.gdescription.required}")
    private String gdescription;
    @Range(min = 0, max = 100, message = "{goods.gprice.invalid}")
    private double gprice;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Past(message = "{goods.gdate.invalid}")
    private Date gdate;

    public Goods() {
    }

    @Override
    public String toString() {
        return "Goods{" +
                "gname='" + gname + '\'' +
                ", gdescription='" + gdescription + '\'' +
                ", gprice=" + gprice +
                ", gdate=" + gdate +
                '}';
    }

    public String getGname() {
        return gname;
    }

    public void setGname(String gname) {
        this.gname = gname;
    }

    public String getGdescription() {
        return gdescription;
    }

    public void setGdescription(String gdescription) {
        this.gdescription = gdescription;
    }

    public double getGprice() {
        return gprice;
    }

    public void setGprice(double gprice) {
        this.gprice = gprice;
    }

    public Date getGdate() {
        return gdate;
    }

    public void setGdate(Date gdate) {
        this.gdate = gdate;
    }
}
